From ce5f74eea0f56f4649dbb53ae6e1758aa28c8dd8 Mon Sep 17 00:00:00 2001 From: "kaf24@firebug.cl.cam.ac.uk" Date: Sat, 6 Aug 2005 09:54:57 +0000 Subject: [PATCH] Fix xenbus_read() usage in shutdown handler. --- linux-2.6-xen-sparse/arch/xen/kernel/reboot.c | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/linux-2.6-xen-sparse/arch/xen/kernel/reboot.c b/linux-2.6-xen-sparse/arch/xen/kernel/reboot.c index ad9550748c..89e8cb42d1 100644 --- a/linux-2.6-xen-sparse/arch/xen/kernel/reboot.c +++ b/linux-2.6-xen-sparse/arch/xen/kernel/reboot.c @@ -248,21 +248,18 @@ static void shutdown_handler(struct xenbus_watch *watch, const char *node) static DECLARE_WORK(shutdown_work, __shutdown_handler, NULL); char *str; - unsigned int len; - str = (char *)xenbus_read("control", "shutdown", &len); - - if (! len) { + str = (char *)xenbus_read("control", "shutdown", NULL); + if (IS_ERR(str)) return; - } xenbus_printf("control", "shutdown", "%i", SHUTDOWN_INVALID); - if (strncmp(str, "poweroff", len) == 0) { + if (strcmp(str, "poweroff") == 0) { shutting_down = SHUTDOWN_POWEROFF; - } else if (strncmp(str, "reboot", len) == 0) { + } else if (strcmp(str, "reboot") == 0) { shutting_down = SHUTDOWN_REBOOT; - } else if (strncmp(str, "suspend", len) == 0) { + } else if (strcmp(str, "suspend") == 0) { shutting_down = SHUTDOWN_SUSPEND; } else { printk("Ignoring shutdown request: %s\n", str); @@ -271,10 +268,8 @@ static void shutdown_handler(struct xenbus_watch *watch, const char *node) kfree(str); - if (shutting_down != SHUTDOWN_INVALID) { + if (shutting_down != SHUTDOWN_INVALID) schedule_work(&shutdown_work); - } - } #ifdef CONFIG_MAGIC_SYSRQ -- 2.30.2